package com.ofek.eventos.remote;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

import com.ofek.eventos.Constants;
import com.ofek.eventos.EventosApplication;
import com.ofek.eventos.db.datatypes.EventData;
import com.ofek.eventos.db.datatypes.Request;
import com.ofek.eventos.db.datatypes.Sync;
import com.ofek.eventos.db.datatypes.SyncRequests;
import com.ofek.eventos.db.datatypes.UserCredential;
import com.ofek.eventos.net.ocsf.client.RemoteService;

public class EventosRemote extends RemoteService {
	public EventosRemote() {
		super(Constants.SERVER_IP, 7879);

	}

	public boolean login(final UserCredential user) throws IOException {
		return (Boolean) handle(user);
	}

	public boolean register(final UserCredential user) throws IOException {
		return (Boolean) handle(user);
	}

	public HashMap<String,ArrayList<EventData>> requestEvents(final HashMap<String, Long> usersLastKnowns) throws IOException {
		return (HashMap<String,ArrayList<EventData>>) handle(EventosApplication.EVENTOS_USER.id,usersLastKnowns);
	}

	public Sync sync(final Sync sync) throws IOException {
		// TODO Auto-generated method stub
		return (Sync) handle(sync);
	}

	public ArrayList<Request> sendRequests(final SyncRequests requests) throws IOException {
		return (ArrayList<Request>) handle(requests);
	}

}
